perf!: reduce hot-path allocations in receipt, send, and signal paths - #519
Conversation
- Receipt: move values instead of cloning (6 clones → 1 per receipt) - Remove dead `Receipt.message_sender` field (duplicated `source.sender`) - Use `encode_and_pad()` instead of `pad_message_v2(encode_to_vec())` for single pre-sized allocation in DM, group SKDM, and signal paths - Remove redundant self-mapping clone in encrypt_for_devices - Remove unused prost import from signal.rs
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR refactors message encryption handling and receipt type management across the codebase. Changes include replacing Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@claude review |
|
Claude finished @jlucaso1's task in 1m 57s —— View job Code Review:
|
Benchmark Results59 unchanged benchmark(s)
|
Summary
Receipt.message_sender: field duplicatedsource.senderand was never readencode_and_pad(): replacepad_message_v2(msg.encode_to_vec())with single pre-sized allocation in DM, group SKDM, and signal encrypt pathsjid_to_encryption_jid.insert(jid, jid.clone())was unnecessary — the encrypt loop already falls back todevice_jidwhen no mapping existsprost::Messageno longer needed in signal.rsBreaking changes
Receipt.message_senderfield removed (was never accessed, always duplicatedsource.sender)Experiment data
From
experiments/heaptrack-impact-lab(10k node benchmark):Test plan
cargo fmt --allcargo clippy --all --testscargo test --all --exclude e2e-testsSummary by CodeRabbit
Breaking Changes
message_senderfield from Receipt events. Code relying on this field requires updates.Refactor